<!DOCTYPE html>
<html>
<head>
	<title>onShow and onHide</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<style>
		#myToolbar {
			margin: 10px;
		}
		#eLog {
			position: relative;
			height: 200px;
			width: auto;
			overflow: auto;
			border: 1px solid #dfdfdf;
			font-family: Roboto, Arial, Helvetica;
			font-size: 14px;
			color: #404040;
			margin: 100px 10px 10px 10px;
			padding: 2px;
		}
	</style>
	<script>
		
		var myToolbar;
		var myPop;
		var eLog;
		var eCount = 0;
		
		function doOnLoad() {
			
			myToolbar = new dhtmlXToolbarObject({
				parent: "myToolbar",
				icons_path: "../common/imgs/",
				xml: "../common/toolbar.xml",
				onload: function() {
					
					myToolbar.setItemText("workbut", "Click #1");
					myToolbar.addButton("second", null, "Click #2", "settings.gif");
					
					myPop = new dhtmlXPopup({ toolbar: myToolbar, id: ["workbut", "second"] });
					
					myPop.attachList("name,price", [
						{id: 1, name: "Audi A5 Coupe", price: "&euro; 31,550"},
						{id: 2, name: "Audi A5 Sportback", price: "&euro; 30,990"},
						myPop.separator,
						{id: 3, name: "Audi A6", price: "&euro; 30,990"},
						{id: 4, name: "Audi A6 Avant", price: "&euro; 37,450"},
						{id: 5, name: "Audi A6 Quattro", price: "&euro; 55,360"},
						myPop.separator,
						{id: 6, name: "Audi TT Coupe", price: "&euro; 29,830"},
						{id: 7, name: "Audi TT RS Coupe", price: "&euro; 59,800"}
					]);
					
					myPop.attachEvent("onShow", function(id){
						logEvent("onShow", id);
					});
					
					myPop.attachEvent("onHide", function(id){
						logEvent("onHide", id);
					});
					
				}
			});
			
			eLog = document.getElementById("eLog");
		}
		
		function logEvent(name, callerId) {
			eLog.innerHTML = (++eCount)+": event fired: "+name+", callerId: "+callerId+"<br>"+eLog.innerHTML;
			eLog.scrollTop = 0;
		}
		
	</script>
</head>
<body onload="doOnLoad()">
	<div id="myToolbar"></div>
	<div id="eLog">
		<br>Click &lt;Click #1&gt; or &lt;Click #2&gt; button to show/hide popup<br>
		Press Esc key or click outside to hide popup
	</div>
</body>
</html>
